﻿@model WorkTimePrj.Models.Vac_OT
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>添加休假、加班数据</title>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/DatePicker/WdatePicker.js")" type="text/javascript"></script>
    <style type="text/css">
        .field-validation-error { float: none; }
        .body ul.cur li { height: 30px; line-height: 30px; }
        .editor-label { width: 90px; float: left; }
        .editor-field { float: left; }
        .Button01 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #003677; height: 20px; border: solid 1px #5381B3; padding-left: 4px; padding-right: 4px; background: #ffffff ; }
        .Sel { display: none; }
        .WP_1 { margin: 15px auto; width: 97%; }
        .WP_2 { margin: 0 auto; width: 97%; }
        .WP_2 ul.cur { margin: 0; }
        .WP_2 ul.cur li { height: 30px; line-height: 30px; color: #000000; }
        table { border-collapse: collapse; width: 400px; /*border:solid 1px #a0a0a0;background:#ebebeb;*/ }
        table tr td { /*border:solid 1px #a0a0a0;*/ height: 40px; line-height: 40px; color: #000000; }
        table tr td.Col1 { width: 95px; /*background:#ebebeb;*/ }
        table tr td.Col2 { /*padding-left:15px;*/ }
    </style>
    <script type="text/javascript">
         $(function () {
//             $('#BtnSubmit').click(function () {
//                 valDate();
             //             });
               if (@ViewBag.refresh==1)
            {
                 window.opener.location.reload();
                //window.close();
            }
             if (window.addEventListener) {
                 //其它浏览器的事件代码: Mozilla, Netscape, Firefox
                 //添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件，不用加on 
                 $('#BtnSubmit')[0].addEventListener('click', valDate, false);
             }
             else {
                 //IE 的事件代码 在原先事件上添加 add 方法
                 $('#BtnSubmit')[0].attachEvent('onclick', valDate);
             }
//             $('#startDate').click(function () {
//                 WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: valDate })
//             });
//             $('#endDate').click(function () {
//                 WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: valDate })
//             });
         });
         function valDate() {
             var date1 = new Date();
             date1.setFullYear($dp.$D('startDate').y, $dp.$D('startDate').M - 1, $dp.$D('startDate').d);
             var dayofwk1 = date1.getDay();
             var date2 = new Date();
             date2.setFullYear($dp.$D('endDate').y, $dp.$D('endDate').M - 1, $dp.$D('endDate').d);
             var dayofwk2 = date2.getDay();
             //debugger
             if (date1>date2) {
                 alert('日期错误！');
                 return false;
             }
             else {
                 return true;
             }
         }
         function pickedFunc1() {
             var dayofwk = $dp.cal.getP('w');
             if (dayofwk != '01')
                 alert('日期错误！只能选择星期一');
         }
         function pickedFunc2() {
             var dayofwk = $dp.cal.getP('w');
             if (dayofwk != '00')
                 alert('日期错误！只能选择星期日');
         }
    </script>
</head>
<body>
    @using (Html.BeginForm("AddVacOT", "Admin", new { startTime = ViewBag.startTime, endTime = ViewBag.endTime }))
    {
        @Html.ValidationSummary(true)
        <div class="WP_1">
            添加休假、加班数据
        </div>
            
        <div class="WP_2">
            <table style="">
                <tr>
                    <td class="Col1">
                        <div class="editor-label">
                            <label>
                                姓名</label>
                        </div>
                    </td>
                    <td class="Col2">
                        <div class="editor-field">
                            @Html.DropDownListFor(model => model.account, Model.accountlist, "---")
                            @Html.ValidationMessageFor(model => model.account)
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="Col1">
                        <div class="editor-label">
                            <label>
                                类型</label>
                        </div>
                    </td>
                    <td class="Col2">
                        <div class="editor-field">
                            @Html.DropDownListFor(model => model.type, Model.typelist, "---")
                            @Html.ValidationMessageFor(model => model.type)
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="Col1">
                        <div class="editor-label">
                            <label>
                                开始日期</label>
                        </div>
                    </td>
                    <td class="Col2">
                        <div class="editor-field">
                            @ViewBag.startTime.ToString("yyyy/MM/dd")
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="Col1">
                        <div class="editor-label">
                            <label>
                                结束日期</label>
                        </div>
                    </td>
                    <td class="Col2">
                        <div class="editor-field">
                            @ViewBag.endTime.ToString("yyyy/MM/dd")
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="Col1">
                        <div class="editor-label">
                            @Html.LabelFor(model => model.hour)
                        </div>
                    </td>
                    <td class="Col2">
                        <div class="editor-field">
                            @Html.EditorFor(model => model.hour)
                            @Html.ValidationMessageFor(model => model.hour)
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input id="BtnSubmit" type="submit" value="保存" class="Button01" />
                    </td>
                </tr>
            </table>
        </div>
    }
    @Html.CommonnScript()
</body>
</html>
